package datastructure.tree;

/**
 *
 * @author Lei
 */
public class MinHeight {

    public static int minHeight(TreeNode root) {
        if (root == null) {
            return 0;
        }

        int leftHeight = minHeight(root.left);
        int rightHeight = minHeight(root.right);

        return leftHeight < rightHeight ? leftHeight + 1 : rightHeight + 1;
    }
}
